<!-- 推荐人管理员管理端统计页面 -->
<template>
  <div class="">
    <!-- ↓↓↓ 社区人员 ↓↓↓ -->
    <div>
      <div id="cardArea">
        <el-card id="totalCount" class="box-card">
          <div class="info-label"><b>总订单数</b></div>
          <div class="info-label2">
            <svg-icon icon-class="table" class="icon" class-name="card-panel-icon" style="color:#409EFF;font-size:50px;float:left" />
            <span id="totalUser-num" class="num">{{ totalOrders }}<span style="font-size:15px">笔</span></span>
          </div>
        </el-card>

        <el-card id="contactCount" class="box-card">
          <div class="info-label"><b>分期订单</b></div>
          <div class="info-label2" style="color:#67C23A  ">
            <svg-icon icon-class="table" class="icon" class-name="card-panel-icon" style="font-size:50px;float:left" />
            <span id="contactUser-num" class="num">{{ totalOrdersStage }}<span style="font-size:15px">笔</span></span>
          </div>
        </el-card>
      </div>
      <div id="cardArea">
        <el-card id="feverCount" class="box-card">
          <div class="info-label"><b>直接订单</b></div>
          <div class="info-label2" style="color:#F56C6C">
            <svg-icon icon-class="table" class="icon" class-name="card-panel-icon" style="font-size:50px;float:left" />
            <span id="feverUser-num" class="num">{{ totalOrdersNotStage }}<span style="font-size:15px">笔</span>  </span>
          </div>
        </el-card>

        <el-card id="hospitalCount" class="box-card">
          <div class="info-label"><b>获得分成</b></div>
          <div class="info-label2" style="color: #E6A23C">
            <svg-icon icon-class="form" class="icon" class-name="card-panel-icon" style="font-size:50px;float:left" />
            <span id="hostipalUser-num" class="num">￥{{ referenceRatio }}<span style="font-size:15px">元</span></span>
          </div>
        </el-card>
      </div>
      <!-- <el-card id="isolationCount" class="box-card">
        <div class="info-label"><b>隔离人数</b></div>
        <div class="info-label2" style="color:purple">
          <svg-icon icon-class="user" class="icon" class-name="card-panel-icon" style="font-size:50px;float:left" />
          <span id="isolationUser-num" class="num">{{ info.isolationUser }}<span style="font-size:15px">人</span></span>
        </div>
      </el-card> -->

    </div>

    <!-- ↑↑↑社区人员↑↑↑ -->
  </div>
</template>

<script>
// 这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
// 例如：import 《组件名称》 from '《组件路径》';
import { allOrderStatisticByRecommend, directOrderStatisticByRecommend, stageOrderStatisticByRecommend, referenceRatio } from '@/api/statistic'
export default {
  name: 'RecommendStatistic',
  // import引入的组件需要注入到对象中才能使用
  components: {},
  data() {
    // 这里存放数据
    return {
      totalOrders: '',
      totalOrdersStage: '',
      totalOrdersNotStage: '',
      referenceRatio: ''

    }
  },
  // 监听属性 类似于data概念
  computed: {},
  // 监控data中的数据变化
  watch: {},
  // 生命周期 - 创建完成（可以访问当前this实例）
  created() {
    this.allOrderStatisticByRecommend()
    this.directOrderStatisticByRecommend()
    this.stageOrderStatisticByRecommend()
    this.getreferenceRatio()
  },
  // 生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {},
  beforeCreate() {}, // 生命周期 - 创建之前
  beforeMount() {}, // 生命周期 - 挂载之前
  beforeUpdate() {}, // 生命周期 - 更新之前
  updated() {}, // 生命周期 - 更新之后
  beforeDestroy() {}, // 生命周期 - 销毁之前
  destroyed() {}, // 生命周期 - 销毁完成
  activated() {},
  // 方法集合
  methods: {
    allOrderStatisticByRecommend() {
      allOrderStatisticByRecommend().then((resp) => {
        this.totalOrders = resp.obj.number
      })
    },
    directOrderStatisticByRecommend() {
      directOrderStatisticByRecommend().then((resp) => {
        this.totalOrdersNotStage = resp.obj.number
      })
    },
    stageOrderStatisticByRecommend() {
      stageOrderStatisticByRecommend().then((resp) => {
        this.totalOrdersStage = resp.obj.number
      })
    },
    getreferenceRatio() {
      referenceRatio().then((resp) => {
        this.referenceRatio = resp.obj / 100
      })
    }
  } // 如果页面有keep-alive缓存功能，这个函数会触发
}
</script>
<style  scoped>

#cardArea{
    margin: 50px;
    display: flex;
    justify-content: center;

}

 .box-card {
    margin-left: 30px;
    width: 400px;
    height: 180px;
  }

 .info-label{
    line-height: 50px;
    margin-top: 0px;
  }

  .info-label2{
    line-height: 100px;
    margin-top: 0px;
  }

  #totalUser-num{
  color: #409EFF;
  /* font-size: 35px; */
}

.info-label
{
  color: #606266;
  /* text-align: right; */
  /* font-size:35px; */
}

.num{
  float:right;
  text-align: right;
  font-size: 35px;
  margin-right: 10px;
  /* margin-left: 60%; */
}

.icon{
  margin-top: 15px;
  text-align: left;
}

</style>
